﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RegisterCustomer.aspx.vb" Inherits="RegisterCustomer" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <script type="text/javascript" src="js/cufon-yui.js"></script>
    <script type="text/javascript" src="js/arial.js"></script>
    <script type="text/javascript" src="js/cuf_run.js"></script>
    <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    .hdr
    {
        background-color: #C0C0C0;
        padding:5px;
        font-weight:bold;
    }
    </style>
    <script type="text/javascript">
        if (window.name.length<=0) {
            window.location = "Login.aspx";
        } else {
         
        }
    </script>
    <script type="text/javascript">
        
        $(document).ready(function () {
            Page.Init();
        });
        function EmailValidate(email) {
            var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
            var address = email;
            return reg.test(address);
        }
        function isNumber(n) {
            return !isNaN(parseFloat(n)) && isFinite(n);
        }
        var Page = {};
        Page.Init = function () {
            $("#btnSubmit").attr("disabled", "disabled");
            //$("#txtUserName").bind("change", Page.CheckUsername);
            $("#txtUserName").blur(Page.CheckUsername);
            $("#txtPassword").blur(Page.CheckPassword);
            $("#txtRePassword").blur(Page.CheckPassword);
            $("#txtEmailID").blur(Page.CheckEmailID);
            $("#txtMobileNo").blur(Page.CheckMobile);
            $("#txtFirstName").blur(Page.CheckFirstName);
            $.fancybox.resize();
        }
        Page.Fields = {};
        Page.Fields.UserName = false;
        Page.Fields.Password = false;
        Page.Fields.RePassword = true;
        Page.Fields.EmailID = false;
        Page.Fields.Mobile = false;
        Page.Fields.FirstName = false;
        Page.Close = function () {
            window.parent.$.fancybox.close()
        }
        Page.Validate = function () {
            if (Page.Fields.UserName && Page.Fields.Password && Page.Fields.RePassword && Page.Fields.EmailID && Page.Fields.Mobile && Page.Fields.FirstName) {
                $("#btnSubmit").removeAttr("disabled")
            } else {
                $("#btnSubmit").attr("disabled", "disabled")
            }
        }
        Page.CheckUsername = function () {
            var uname = $("#txtUserName").val();
            if (uname != "" || uname == undefined) {
                Page.Fields.UserName = true;
                $("#txtUserName_err").hide();
            } else {
                Page.Fields.UserName = false;
                $("#txtUserName_err").show();
            }
            Page.Validate();
        }
        Page.CheckPassword = function () {
            var pass = $("#txtPassword").val();
            var repass = $("#txtRePassword").val();
            if (pass != "") {
                if (pass == repass) {
                    Page.Fields.Password = true;
                    $("#txtPassword_err").hide();
                    $("#txtRePassword_err").hide();
                } else {
                    Page.Fields.Password = false;
                    $("#txtPassword_err").show();
                    $("#txtRePassword_err").show();
                }
            } else {
                Page.Fields.Password = false;
                $("#txtPassword_err").show();
                $("#txtRePassword_err").show();
            }
            Page.Validate();
        }
        Page.CheckEmailID = function () {
            var email = $("#txtEmailID").val();
            Page.Fields.EmailID = EmailValidate(email);
            if (Page.Fields.EmailID)
            {
                $("#txtEmailID_err").hide();
            } else {
                $("#txtEmailID_err").show();
            }
            Page.Validate();
        }
        Page.CheckMobile = function () {
            var mobile = $("#txtMobileNo").val();
            Page.Fields.Mobile = isNumber(mobile);
            if (Page.Fields.Mobile) {
                $("#txtMobileNo_err").hide();
            } else {
                $("#txtMobileNo_err").show();
            }          
            Page.Validate();
        }
        Page.CheckFirstName = function () {
            var fname = $("#txtFirstName").val();
            if (fname != "") {
                Page.Fields.FirstName = true;
                $("#txtFirstName_err").hide();
            } else {
                Page.Fields.FirstName = false;
                $("#txtFirstName_err").show();
            }
            Page.Validate();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField runat="server" ID="txtIniTime" />
    <asp:Panel ID="panelForm" runat="server">
    
    <div class="hdr">Login Information *</div>
<div>
    <table>
        <tr>
            <td width="100">Username</td>
            <td><asp:TextBox ID="txtUserName" runat="server" ></asp:TextBox></td>
            <td class="regerrmsg" id="txtUserName_err">Invalid username</td>
        </tr>
        <tr>
            <td>Password</td>
            <td><asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox></td>
            <td class="regerrmsg" id="txtPassword_err">Invalid password</td>
        </tr>
        <tr>
            <td>Retype Password</td>
            <td><asp:TextBox ID="txtRePassword" runat="server" TextMode="Password"></asp:TextBox></td>
            <td class="regerrmsg" id="txtRePassword_err">Invalid password</td>
        </tr>
    </table>
</div>
<div class="hdr">Personal details</div>
<div>
    <table>
        <tr>
            <td  width="100">Email ID *</td>
            <td><asp:TextBox ID="txtEmailID" runat="server"></asp:TextBox></td>
            <td class="regerrmsg" id="txtEmailID_err">Invalid email id</td>
        </tr>
        <tr>
            <td>Mobile No. *</td>
            <td><asp:TextBox ID="txtMobileNo" runat="server"></asp:TextBox></td>
            <td class="regerrmsg" id="txtMobileNo_err">Invalid mobile no.</td>
        </tr>
        <tr>
            <td>First name *</td>
            <td><asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox></td>
            <td class="regerrmsg" id="txtFirstName_err">Invalid firstname</td>
        </tr>
        <tr>
            <td>Last name</td>
            <td><asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
            <td class="regerrmsg" id="txtLastName_err">Invalid password</td>
        </tr>
        
        <tr>
            <td></td>
            <td>
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" /></td>
        </tr>
    </table>
</div>
</asp:Panel>
    <asp:Panel ID="panelMessage" runat="server" Visible="False">
    
<div class="regmessage">An verification email containing verification link has been sent to you, click on the verification link to continue with the subscription</div>
<div class="regmessage"><input type="button" value="Close" onclick="Page.Close()" /></div>
</asp:Panel>
 <asp:Panel ID="panelExist" runat="server" Visible="False">
    
<div class="regmessage">The username you have used is already exist in our database, please use some other username.</div>
<div class="regmessage"><input type="button" value="Close" onclick="Page.Close()" /></div>
</asp:Panel>
    </form>
</body>
</html>
